<?php
  //include ('header.php');
   include ('lang/ua.lang');
  require_once('includes/db_connect.inc.php');
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $titles['obl_card'] ?></title>	
</head>
<link rel='stylesheet' type='text/css' href='css/site.css' />
<body>
<table class="IND_INVENTORY_PRINT" width="90%">
<tr>
<td align="right">
<div class="noprint"><a href='javascript: void(0);'><img src=images/print2.png border=0 height=30 weight=30 onclick="print()"></a>
</div>
<div id=\"floatTip\"></div>
</td></tr></table>
<?php
if ($_GET['inv_number']){
$_SESSION['inv_number']=$_GET['inv_number'];
}
?>

<?php
if (isset($_POST['edit_full_card']) and $_POST['edit_full_card']) {

$sql="delete 
FROM inventory_individual where inv_number='".$_SESSION['inv_number']."'";  
$process=mysql_query($sql, $db);
//echo $sql;
for ($n = 1; $n <= $_SESSION["count_r"]; $n++) {


$code="code".$n;
$model="model".$n;
$sn="sn".$n;
$date_start="date_start".$n;
$note="note".$n;
$sql="insert into inventory_individual (inv_number,code,model,sn,date_start,note) 
values ('".$_SESSION['inv_number']."','".$_POST[$code]."','".$_POST[$model]."','".$_POST[$sn]."','".$_POST[$date_start]."','".$_POST[$note]."')";
$process=mysql_query($sql, $db);

}
}




?>
<center><H2><?php echo $texts['obl_card'] ?></H2></center>
<center><H3><?php echo $texts['inv_number'] ?><?php echo $_SESSION['inv_number']?></H3></center>
<table class="IND_INVENTORY_PRINT " width="70%">
<tr>
	<td rowspan=3 class="IND_INVENTORY" width=25>I</td>
	<td rowspan=3 class="IND_INVENTORY"><?php echo $texts['dislocation'] ?></td>
	<td class="IND_INVENTORY"><?php echo $texts['facultet'] ?></td>
	<td class="IND_INVENTORY">інженерний</td>
</tr>
<tr>
	<td class="IND_INVENTORY"><?php echo $texts['otdel'] ?></td>
	<td class="IND_INVENTORY">ІТП</td>
</tr>
<tr>
	<td class="IND_INVENTORY"><?php echo $texts['addres'] ?></td>
	<td class="IND_INVENTORY">Г 1311</td>
</tr>
<tr>
	<td class="IND_INVENTORY">II</td>
	<td class="IND_INVENTORY"><?php echo $texts['create'] ?></td>
	<td colspan=2 class="IND_INVENTORY">2007</td>
</tr>
<tr>
	<td class="IND_INVENTORY">III</td>
	<td class="IND_INVENTORY"><?php echo $texts['inventory_man'] ?></td>
	<td colspan=2 class="IND_INVENTORY"> Сітало</td>
</tr>
</table>
<br>
<form name="edit_card"  method="POST">
<table class="IND_INVENTORY_PRINT" width=90%>
<tr>
<td class="IND_INVENTORY" width=25>IV
</td>
<td colspan=5 class="IND_INVENTORY_C"><b>Відомості про базову конфігурацію комп'ютеризованого робочого місця</b></td>
</tr>
<tr>
	<td colspan=6 align="center" class="IND_INVENTORY_C"><b>Внутрішні пристрої</b></td>
</tr>
<tr>
    <td class="IND_INVENTORY" >№</td>
	<td class="IND_INVENTORY_C">Найменування</td>
	<td class="IND_INVENTORY_C">Модель</td>
	<td class="IND_INVENTORY_C">Серійний номер</td>
	<td class="IND_INVENTORY_C">Дата встановлення</td>
	<td class="IND_INVENTORY_C">Примітка</td>

</tr>
<?php
$sql="SELECT *
FROM `inventory_individual`
RIGHT JOIN `item_codes` ON `inventory_individual`.`code` = `item_codes`.`id_code`
AND `inventory_individual`.`inv_number`='".$_SESSION['inv_number']."' order by `item_codes`.`id_code`";  
$process=mysql_query($sql, $db);
$i=1;
$j=0;
while ($row = mysql_fetch_array($process, $i)){
$j++;
echo "<tr>";
	echo "<td class=\"IND_INVENTORY\" width=18>$j</td>";
	echo "<td class=\"IND_INVENTORY\" width=220>".$row['name_code']."</td>";
	echo "<td class=\"IND_INVENTORY\" width=20%\">".$row['model']."</td>";
	echo "<td class=\"IND_INVENTORY\" width=\"10%\">".$row['sn']."</td>";
	echo "<td class=\"IND_INVENTORY\" width=\"10%\">".$row['date_start']."</td>";
	echo "<td class=\"IND_INVENTORY\" width=\"*\">".$row['note']."</td>";
echo "</tr>";
?>
 <script type="text/javascript">
$(document).ready(function(){
  // ---- Календарь -----
  $('#data_open_<?php echo $j?>').attachDatepicker();
});
</script> 
<?php
if ($j==20){
echo "<tr>";
echo "<td colspan=6 class=\"IND_INVENTORY_C\"><b>Зовнішні пристрої та перефірія</b></td>";
echo "</tr>";
}
echo "</tr>";

};
$_SESSION["count_r"]=$j;
?>
</table>

</form>


</body>
</html>





